import { useThemeStore } from "@/stores/models/theme";
import { generate } from "@ant-design/colors";

// 主题颜色覆盖
export const setThemeOverrides = () => {
  const themeStore = useThemeStore();
  const themeConfig = themeStore.themeConfig;

  const primaryColors = generate(themeConfig.primary);
  const infoColors = generate(themeConfig.info);
  const successColors = generate(themeConfig.success);
  const warningColors = generate(themeConfig.warning);
  const errorColors = generate(themeConfig.error);

  const commonColors = {
    primaryColor: primaryColors[5],
    primaryColorHover: primaryColors[4],
    primaryColorSuppl: primaryColors[4],
    primaryColorPressed: primaryColors[6],

    infoColor: infoColors[5],
    infoColorHover: infoColors[4],
    infoColorSuppl: infoColors[4],
    infoColorPressed: infoColors[6],

    successColor: successColors[5],
    successColorHover: successColors[4],
    successColorSuppl: successColors[4],
    successColorPressed: successColors[6],

    warningColor: warningColors[5],
    warningColorHover: warningColors[4],
    warningColorSuppl: warningColors[4],
    warningColorPressed: warningColors[6],

    errorColor: errorColors[5],
    errorColorHover: errorColors[4],
    errorColorSuppl: errorColors[4],
    errorColorPressed: errorColors[6],

    borderRadius: themeConfig.borderRadius + "px",

    fontSize: themeConfig.fontSize + "px",
    fontSizeMini: themeConfig.fontSize - 2 + "px",
    fontSizeTiny: themeConfig.fontSize - 2 + "px",
    fontSizeSmall: themeConfig.fontSize + "px",
    fontSizeMedium: themeConfig.fontSize + "px",
    fontSizeLarge: themeConfig.fontSize + 1 + "px",
    fontSizeHuge: themeConfig.fontSize + 2 + "px",
  };
  return commonColors;
};
